<?php

/**
 * Other fuction PHP
 * 
 * @author Tham
 */
class Helper {

    function rand_string($length) {
        $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        $size = strlen($chars);
        for ($i = 0; $i < $length; $i++) {
            $str .= $chars[rand(0, $size - 1)];
        }
        return $str;
    }

    function LinkLocationbyTypeUser() {
        $type_user = 1;


        if (isset($_SESSION['userlogin']['type_user'])) {
            $type_user = $_SESSION['userlogin']['type_user'];
        }
        if ($type_user == 1) {
            $url = get_site_url() . '/locate-model';
        } else {
            $url = get_site_url() . '/manager-locate-model';
        }
        return $url;
    }

    public static function SubStrText($str, $limit) {
        
        $str = strip_tags($str);
        $str = substr($str, 0, $limit);
        return $str;
    }

}

?>